<div class="layui-card-header layui-card">
    <span class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">首页</a>
        <a>商户支付渠道</a>
        <a><cite>支付渠道详情</cite></a>
    </span>
</div>
<style>
    .layui-form-label {
        width:15% !important;
        margin-left:1%;
    }
    .layui-input-inline {
        width: 33% !important;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">支付渠道详情</li>
            </ul>
            <div class="layui-tab-content">
                <form class="layui-form layui-form-pane" id="layuiadmin-app-form-list">
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户ID</label>
                        <div class="layui-input-inline">
                            <input type="text" id="mchId" name="mchId" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">商户名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="name" name="name" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">应用ID</label>
                        <div class="layui-input-inline">
                            <input type="text" id="appId" name="appId" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">应用场景</label>
                        <div class="layui-input-inline">
                            <input type="text" id="scene" name="scene" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">应用状态</label>
                        <div class="layui-input-inline">
                            <input type="text" id="state" name="state" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <input type="text" id="remark" name ="remark" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付产品</label>
                        <div class="layui-input-inline">
                            <input type="text" id="channelType" name ="channelType" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">商户渠道ID</label>
                        <div class="layui-input-inline">
                            <input type="text" id="channelMchId" name="channelMchId" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">渠道费率(%)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="channelRate" name="channelRate" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">创建时间</label>
                        <div class="layui-input-inline">
                            <input type="text" id="createTime" name="createTime" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">修改时间</label>
                        <div class="layui-input-inline">
                            <input type="text" id="updateTime" name="updateTime" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">渠道支付参数</label>
                        <div class="layui-input-inline">
                            <textarea name="param" id="param" name="param" placeholder="请输入渠道支付参数" class="layui-textarea" disabled="disabled"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left: 12px">
                            <a class="layui-btn backBtn" onclick="back()">返回</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['table','util','admin', 'form'], function() {
        var table = layui.table
            ,$ = layui.$
            ,form = layui.form
            ,admin = layui.admin
            ,element = layui.element;

        element.render('breadcrumb', 'breadcrumb'); // 渲染导航信息

        var curAppId = layui.router().search.id;
        admin.req({
            type: 'get',
            url: layui.setter.baseUrl + '/mch_channel/get',
            data: {
                id : curAppId
            },
            error: function(err){
                layer.alert(err, {
                    title: 'error'
                })
            },
            success: function(res) {
                if (res.code == '0') {
                    $('#name').val(res.data.name);
                    $('#appId').val(res.data.appId);
                    $('#mchId').val(res.data.mchId);
                    $('#remark').val(res.data.remark);
                    $('#channelType').val(res.data.channelType == 'alipay' ? "支付宝支付" : res.data.channelType == 'wxpay' ? "微信支付" : res.data.channelType == 'qpay' ? "qq支付" : res.data.channelType == 'upacp' ? "银联支付" : res.data.channelType == 'applepay' ? "苹果支付" : res.data.channelType == 'bfb' ? "百付宝支付" : res.data.channelType == 'jdpay' ? '京东支付' : res.data.channelType == 'kqpay' ? "快钱支付" : "发生错误");
                    if (res.data.scene == 1) {
                        $('#scene').val('移动APP');
                    } else if (res.data.scene == 2) {
                        $('#scene').val('移动网页');
                    } else if (res.data.scene == 3) {
                        $('#scene').val('PC网页');
                    } else if (res.data.scene == 4) {
                        $('#scene').val('微信公众平台');
                    } else if (res.data.scene == 5) {
                        $('#scene').val('手机扫码');
                    }

                    if (res.data.state == 1) {
                        $('#state').val("启用");
                    } else {
                        $('#state').val("停止");
                    }

                    $('#channelId').val(res.data.channelId);
                    $('#channelMchId').val(res.data.channelMchId);
                    $('#channelRate').val(res.data.channelRate);
                    if (res.data.createTime != "" && res.data.createTime != null) {
                        $('#createTime').val(layui.util.toDateString(res.data.createTime));
                    }
                    if (res.data.updateTime != "" && res.data.updateTime != null) {
                        $('#updateTime').val(layui.util.toDateString(res.data.updateTime));
                    }
                    $('#param').val(res.data.param);
                } else {
                    layer.alert(res.msg,{title: '请求失败'})
                }
            }
        })
    })

    function back(){
        location.href = layui.setter.baseLocal + "app/mch_channel/index";
    }
</script>